package com.ncloud.product.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import com.ncloud.product.entity.ProdItem;

@Mapper
public interface ProdItemMapper{


	@Select("select * from bs_p_prod_item_rel where prod_id=#{prodId} and (node_type=#{nodeType} or #{nodeType} is null)"
			+ " and now() between begin_date and end_date")
	@Results({@Result(column="rel_id",property="relId"),@Result(column="prod_id",property="prodId"),
		@Result(column="item_code",property="itemCode"),
		@Result(column="begin_date",property="beginDate"),@Result(column="end_date",property="endDate")})
	List<ProdItem> getProdItems(@Param("prodId")Long prodId, @Param("nodeType")String nodeType);

}
